﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;

namespace Twi.DataAccess.Common
{
    /*
    * Copyright: ©2014 踏影软件开发工作室【Tyingsoft、Twilight、Twifly】版权所有
    * Author: xuzhihong
    * Create date: 2014-05-26
    * Description: DbCommand 扩展方法
    * 
    */
    public static class ExtensionDbCommand
    {
        public static DataTable ExecuteDataTable(this DbCommand command,DbUtility db)
        {
            DataTable dt = new DataTable();
            using (DbDataAdapter adapter = db.providerFactory.CreateDataAdapter())
            {
                adapter.SelectCommand = command;
                DataTable data = new DataTable();
                adapter.Fill(data);
                return data;
            }
        }
    }
}
